﻿using UnityEngine;
using System.Collections;

namespace AutoRoot
{
   public class SkipToDecisionPoint : ButtonStateHandler
   {
      public override void Execute()
      {
         Global.LoadAudio(Global.currentSection.Value.decisionResourcePath);

         //Get decision count
         int decisionCount = 2;

         GameObject.Find("ButtonPlayOrPause").SendMessage("OnOldState", SendMessageOptions.DontRequireReceiver);

         GameObject.Find("ControlPart").SendMessage("OnPlayDecision", decisionCount, SendMessageOptions.DontRequireReceiver);
         
         GameObject.Find("Progressbar").SendMessage("updateTotalTime", Global.currentAudio.clip.length, SendMessageOptions.DontRequireReceiver);

         GameObject.Find("ButtonReplay").GetComponent<Replay>().Execute();
      }
   }
}
